package sjd.socket;
import java.net.*;
import java.io.*;
import java.util.*;
public class MyServerSocket extends ServerSocket 
{
	private ServerSocket serversocket;
	private Hashtable socketgroup;
	public MyServerSocket(ServerSocket sc)throws IOException
	{
		this.serversocket=sc;
		socketgroup=new Hashtable();
	}
	public void send(MySocket mysocket,String message)
	{
		mysocket.send(message);
	}
	public String receive(MySocket mysocket)throws IOException
	{
		return mysocket.receive();	
	}
	public Socket accept()throws IOException
	{
		return serversocket.accept();
	}
	public Hashtable getSocketGroup()
	{
		return socketgroup;
	}
	public boolean closeSocket(MySocket mysocket,String socketname)throws IOException
	{
		mysocket.close();
		socketgroup.remove(socketname);
		return true;
	}
	public boolean addSocket(MySocket mysocket,String socketname)throws IOException
	{
		if(socketgroup.get(socketname)!=null)
			return false;
		socketgroup.put(mysocket, socketname);
		return true;
	}	
}
